package com.jzg.sys.manager;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jzg.sys.dao.entity.SecRole;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jzg.sys.dao.mapper.SecRoleMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


/**
 * 角色管理
 */
@Service
public class SecRoleManager extends ServiceImpl<SecRoleMapper, SecRole>  {

    @Resource
    private SecRoleMapper roleMapper;

    public IPage<SecRole> findEasyPage(Page<SecRole> page, SecRole secRole) {
        return roleMapper.selectPage(page,new QueryWrapper<SecRole>()
                        .lambda()
                        .like(StringUtils.isNotBlank(secRole.getRoleCode()),SecRole::getRoleCode,secRole.getRoleCode())
                        .like(StringUtils.isNotBlank(secRole.getRoleName()),SecRole::getRoleName,secRole.getRoleName())
                        .eq(StringUtils.isNotBlank(secRole.getSysCode()),SecRole::getSysCode,secRole.getSysCode()));
    }
}
